<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>
	<body>
		<script>
			// 生成0~99随机数
			var randNum = 55 //Math.floor(Math.random() * 100)
			var count = 3
			var isSus = false
			for (var i = 0; i < count; i++) {
				var inpNum = +prompt('请输入您猜测的数字:')
				if (randNum > inpNum) {
					alert('您猜测的数字小了')
				} else if (randNum < inpNum) {
					alert('您猜测的数字大了')
				} else {
					alert('您猜对了')
					isSus = true
				}

				if (isSus) {
					alert('您的机会已经用完')
				}
				/* if (i === count - 1) {
					alert('您的机会已经用完')
				} */
			}
		</script>
	</body>
</html>
